﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DungeonMaker
{
    class Menu
    {
        private GUI g = new GUI();
        

        public Menu(string headline, string secondrow) 
        {
            g.WriteTextAt(headline, g.centerText(headline,3), ConsoleColor.Green);
            g.WriteTextAt(secondrow, g.centerText(secondrow, 4), ConsoleColor.Cyan);
            Line();
        }
        private void Line() 
        {
            var pos = new Position(0, 6);
            for (int i = 0; i < Console.BufferWidth; i++)
            {
                pos.X = i;
                g.WriteTextAt("_", pos, ConsoleColor.Red);
            }
        }
        public byte Questions(List<string> q) 
        {
            var pos = new Position(4,8);

            for (int i = 0; i < q.Count; i++)
            {
                var s = q[i];

                g.WriteTextAt(String.Format("{0}: {1}",i+1, s), pos);
                pos.Y++;

            }
            var ckey = Console.ReadKey(true);

            for (int i = 0; i < q.Count; i++)
			{
                if (ckey.Key.ToString() == (ConsoleKey.D).ToString() + i.ToString()) 
                {
                    return (byte) i;
                    
                }
            
			}

            return 0;

        }
    }
}
